<?php
	class MemberListView {
		
		private $m_removeButton = "remove";
		
		/**
		 * @return string $html
		 */
		public function MemberListBox (MemberListHandler $mlh) {
			$html = "<div>
						<form method='post'>
							<fieldset>
								<ul>";
			
			$memberList = $mlh->GetMemberList();
			
			foreach ($memberList as $value) {
				if ($value != $_SESSION['loggedIn']) {
					$html .= "<li><input type='submit' name='$value' value='Remove' /> $value</li>";
				}
			}
			
			$html .= "			</ul>
							</fieldset>
						</form>
					</div>";			
			
			return $html;
		}
		
		/**
		 * @return string $html
		 */
		public function NotLoggedInBox () {
			return "<div>
						<a href='?'>This is only for member, return here!</a>
					</div>";
		}
		
		/**
		 * @return boolean removeButton
		 */
		public function TriedToRemoveMember() {
			if (count(array_keys($_POST, "Remove")) == 1) {
				return true;
			}
			
			return false;
		}
		
		/**
		 * @return string $ret
		 */
		public function GetRemoveUsername() {
			if (count(array_keys($_POST, "Remove")) == 1) {
				$ret = array_keys($_POST, "Remove");
				$ret = end($ret);
				return $ret;
			}
			return null;
		}
	}
?>